<?php
namespace Home\Controller;
use Think\Controller;
// +----------------------------------------------------------------------
// | Fanwe 方维p2p借贷系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 云淡风轻(88522820@qq.com)
// +----------------------------------------------------------------------

class LoginController extends  BaseController{
	//首页
    public function index()
    {
        if($this->is_weixin()){
            header('https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4a6d0b9fa17894ce&redirect_uri=http%3a%2f%2fwap.yzlicai.com%2findex.php%3fm%3dHome%26c%3dUserwxregister%26a%3dindex&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect');
            exit;
        }
        //$root['act'] = "login";
        $root['program_title'] = "登录";
        $root['act'] = CONTROLLER_NAME;
        $this->assign('data',$root);
        $this->display();
    }
    public function is_weixin() {
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
            return true;
        }
        return false;
    }

    public function weixin_version() {
        preg_match('/.*?(MicroMessenger\/([0-9.]+))\s*/', $_SERVER['HTTP_USER_AGENT'], $matches);
        echo '你的微信版本号为:'.$matches[2];
    }
}
?>